package com.right.near.business.controller;

import com.right.near.business.model.ao.LoginAO;
import com.right.near.business.model.vo.LoginVO;
import com.right.near.business.service.IAuthService;
import com.right.near.business.service.IUserService;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 认证接口
 *
 * @author: Star.zhu
 * @date: 2022/8/12
 */
@RestController
@AllArgsConstructor
@RequestMapping("/auth")
public class AuthController {

    private final IAuthService service;

    /**
     * 账号密码登陆认证
     *
     * @param ao 登陆数据
     * @return LoginVo
     */
    @PostMapping("/user/login")
    public LoginVO userLogin(@Validated @RequestBody LoginAO ao) {
        return service.userLogin(ao);
    }

}
